import { ApiUserInfo } from "@/request/api";
export default {
  namespaced: true,
  state: {
    user: {
      headImgUrl: "../../assets/images/default.jpg",
      nickname: "小胡同学",
    },
  },
  mutations: {
    changeUserInfo(state, payload) {
      state.user = payload.userInfo;
    },
    // 初始化用户信息，当没有token时调用此方法
    initUserInfo(state) {
      state.userInfo = {
        headImg: require("../../assets/images/default.jpg"),
        nickName: "昵称",
      };
    },
  },
  actions: {
    async asyncChangeUserInfo({ commit }, payload) {
      // 第一步发请求
      let res = await ApiUserInfo();
      console.log(res);
    },
  },
};
